﻿$(function () {
    $("button", "#container").button();

    $(":submit").button();
    $("#tabs").tabs({
        cookie: {
            // store cookie for a day, without, it would be a session cookie
            expires: 1
        }
    });


        //鼠标划过高亮
        $("#list-contain tbody tr").hover(function () {
            $(this).addClass("ui-state-highlight");
        }, function () {
            $(this).removeClass("ui-state-highlight");
        });

        ////给class为stripe_tb的表格的偶数行添加class值为alt
        //$("#list-contain tbody tr:even").addClass("alt");

    //    //设置日历控件的语言区域
    //    $.datepicker.setDefaults($.datepicker.regional["zh-CN"]);
});

/*全选*/
function SelectAll(chk) {
    var isCheck = chk.checked;
    $("#tbList input[type=checkbox]").each(function () {
        //判断全选按钮控制以外的复选框，这些复选框将不会进行全选处理
        if (this.disabled == false) {
            this.checked = isCheck;
        }

    });
}

/*获取列表对象中的勾选项的数量*/
function CheckedCount(conName) {
    var result = 0;
    $("#" + conName + " input[type=checkbox][class!='noSelected']").each(function () {
        if (this.id != "chkSelectAll" && this.disabled == false && this.checked)
        { result += 1; }
    });
    return result;
}

/*询问对话框*/
function JQueryConfirm(dlg, title, content, btnOkText, btnCancelText, okCallback, cancelCallback) {
    JQueryConfirmEx(dlg, title, content, 320, 140, btnOkText, btnCancelText, okCallback, cancelCallback);
}
function JQueryConfirmEx(dlg, title, content, w, h, btnOkText, btnCancelText, okCallback, cancelCallback) {
    dlg.html(content);
    dlg.dialog({
        modal: true,
        title: title,
        width: w,
        height: h,
        show: "explode",
        hide: "explode",
        buttons: [{ text: btnOkText, click: okCallback }, { text: btnCancelText, click: cancelCallback}],
        close: function (event, ui) { dlg.remove(); }
    });
}

/*提示对话框*/
function JQueryMessage(dlg, title, content, btnOkText, okCallback) {
    JQueryMessageEx(dlg, title, content, 320, 140, btnOkText, okCallback);
}
function JQueryMessageEx(dlg, title, content, w, h, btnOkText, okCallback) {
    dlg.html(content);
    dlg.dialog({
        modal: true,
        title: title,
        width: w,
        height: h,
        show: "explode",
        hide: "explode",
        buttons: [{ text: btnOkText, click: okCallback}],
        close: function (event, ui) { dlg.remove(); }
    });
}

/*弹出窗口*/
function JQueryWindow(dlg, title, iFrameUrl, closeCallback) {
    JQueryWindowEx(dlg, title, iFrameUrl, 800, 600, closeCallback);
}
function JQueryWindowEx(dlg, title, iFrameUrl, w, h, closeCallback) {
    dlg.html("<iframe width='100%' height='100%' frameborder='0' scrolling='auto' src='" + iFrameUrl + "'><\/iframe>");
    dlg.dialog({
        modal: true,
        title: title,
        width: w,
        height: h,
        show: "explode",
        hide: "explode",
        close: function (event, ui) { dlg.remove(); closeCallback(); }
    });
}
